/*
 *  Substructure.cpp
 *  CompoundParser
 *
 *  Created by Ryan Edwards-Crewe on 20-02-10.
 *  Copyright 2010 RECCoder. All rights reserved.
 *
 */

#include "Substructure.h"

Substructure::Substructure() {};

Substructure::~Substructure() {};

int Substructure::setSubsData(char& ch, FILE* fptr) {
	if (8 > fscanf(fptr, "%d%s%d%s%d%s%s%d", 
				   &SUBSTRUCTURE_ID,
				   SUBSTRUCTURE_NAME,
				   &ROOT_ATOM_ID,
				   SUBSTRUCTURE_TYPE,
				   &DICTIONARY_TYPE,
				   CHAIN,
				   CHAIN_SUBTYPE,
				   &INTERSUBSTRUCTURE_BONDS))
		return -1;
	else 
		return 0;
}

void Substructure::writeSubsData(int cid, FILE* fptr) {
	//	std::cout << SUBSTRUCTURE_NAME << std::endl;
	fprintf(fptr, "(%d, %d, '%s', %d, '%s', %d, '%s', '%s', %d)", 
			cid,			
			SUBSTRUCTURE_ID,
			SUBSTRUCTURE_NAME,
			ROOT_ATOM_ID,
			SUBSTRUCTURE_TYPE,
			DICTIONARY_TYPE,
			CHAIN,
			CHAIN_SUBTYPE,
			INTERSUBSTRUCTURE_BONDS);
}